from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
import time
testCase = "DBshop016_删除侧边设置"

firefox=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(firefox) #调用函数登录dbshop的后台
DBshopEnterMenu3(firefox,"商品管理","管理分类","前台侧边设置")
name="网站很好看"#15添加的数据
# 15已结添加
# AA  firefox.find_element_by_link_text("删除").click()#只有一条数据
firefox.find_element_by_xpath('//td[contains(.,"%s")]/following-sibling::td[3]/a[2]'%name).click()#多条数据

time.sleep(1)
#js弹框的处理
firefox.switch_to.alert.accept()
time.sleep(1)
# AA  wu=firefox.find_element_by_xpath("//td[text()='暂无显示设置']").text

try:
    firefox.find_element_by_xpath('//td[contains(.,"%s")]'%name).is_displayed()
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testCase)
firefox.quit()




# try:
#     wu=="暂无显示设置"
#     writeLog("%s 测试通过" % testCase)
# except:
#     writeLog("%s 测试失败" % testCase)